<?php

declare (strict_types=1);
/**
 * @copyright 深圳市易果网络科技有限公司
 * @version 1.0.0
 * @link https://dayiguo.com
 */

namespace App\Dao;

use App\Kernel\Traits\DaoTrait;
use App\Model\OrderItem;

/**
 * class
 *
 * @author 谢声强(861167322@qq.com)
 * @package App\Dao
 */
class OrderItemDao extends Dao
{
    use DaoTrait;

    public function model(): string
    {
        return OrderItem::class;
    }

    /**
     * 获得单个订单的商品
     * @param int $order_id
     * @param int $paginate
     * @return mixed
     */
    public function getItemsByOrderId(int $order_id, int $paginate = 10)
    {
        return OrderItem::query()
            ->where('goods_id', $order_id)
            ->paginate($paginate);
    }

}